home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
redakcyjne
/
programy
/
Tlen 6.0.1.12 pl
/
tleninst60112.exe
/
sdk
/
Plugin_src
/
options-bcb
/
Unit1.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2006-09-18
|
4KB
|
136 lines
//---------------------------------------------------------------------------
#include <vcl.h>
#include <windows.h>
#pragma hdrstop
#pragma argsused
#include "../../TlenSources/plugin/plugin_struct.h"
#include "../../TlenSources/plugin/plugin_options.h"
#include "Unit3.h"
HINSTANCE hInst;
TLENPLUGINFUNCTIONS *tlen_functions;
TForm3 *option_window = NULL;
HBITMAP icon1, icon2;
TLENPLUGININFO pluginInfo={
sizeof(TLENPLUGININFO),
"Obs│uga opcji - BCB",
PLUGIN_API_VERSION,
MAKE_DWORD_VERSION(1,2,3,4),
"Opis pluginu",
"⌐ Prawa autorskie",
"Producent",
"E@mail",
"http://www",
0,
0,
0,
0
};
extern "C" __declspec(dllexport) TLENPLUGININFO* GetPluginInfo(DWORD TlenVersion);
extern "C" __declspec(dllexport) int LoadPlugin(TLENPLUGINFUNCTIONS *tlen_functions);
extern "C" __declspec(dllexport) int UnloadPlugin(void);
static int OptionPageClicked(WPARAM wParam, LPARAM lParam)
{
TlenOptionPageShowInfo *info = (TlenOptionPageShowInfo *) wParam;
strcpy(info->Caption, "Przyk│adowa nazwa zak│adki");
strcpy(info->Description, "To jest opis zak│adki, tutaj mo┐na wstawiµ d│u┐szy tekst, aby wyja£niµ u┐ytkownikowi, co siΩ tu dzieje.");
switch (info->Action)
{
case TLEN_OPTIONS_PAGE_ACTION_SHOW:
{
if (!option_window)
{
option_window = new TForm3(NULL);
option_window->ParentWindow = info->Handle;
tlen_functions->CallTlenFunction(hInst, TLEN_ADD_DIALOG_HANDLE, (WPARAM) option_window->Handle, NULL);
}
info->Icon = icon1;
info->Flags |= TLEN_OPTIONS_PAGEINFO_FLAG_ICONTRANS;
option_window->SetBounds(info->x, info->y, info->width, info->height);
option_window->Visible = true;
break;
}
case TLEN_OPTIONS_PAGE_ACTION_HIDE:
{
if (option_window) option_window->Visible = false;
break;
}
case TLEN_OPTIONS_PAGE_ACTION_OK:
{
//KlikniΩto ok, wiΩc przetwarzamy tutaj opcje wybrane przez u┐ytkownika
}
case TLEN_OPTIONS_PAGE_ACTION_APPLY:
case TLEN_OPTIONS_PAGE_ACTION_CANCEL:
{
//Usuwamy uchwyt okienka z listy i niszczmy je
if (option_window)
{
tlen_functions->CallTlenFunction(hInst, TLEN_REMOVE_DIALOG_HANDLE, (WPARAM) option_window->Handle, NULL);
delete option_window;
option_window = NULL;
}
break;
}
}
return 0;
}
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
hInst=hinst;
return 1;
}
__declspec(dllexport) TLENPLUGININFO* GetPluginInfo(DWORD tlenVersion)
{
return &pluginInfo;
}
__declspec(dllexport) int LoadPlugin(TLENPLUGINFUNCTIONS *functions)
{
icon1 = (HBITMAP) LoadImage(hInst, MAKEINTRESOURCE(104),IMAGE_BITMAP, 32, 32, NULL);
icon2 = (HBITMAP) LoadImage(hInst, MAKEINTRESOURCE(105),IMAGE_BITMAP, 16, 16, NULL);
tlen_functions = functions;
TlenOptionPageDefinition def;
InitializeStruct(def);
def.CallBack = OptionPageClicked;
def.ID = "BasicPluginBCB/Page1";
def.Caption = "Dodatkowa zak│adka 2";
def.Icon = icon2;
def.Flags = TLEN_OPTIONS_PAGEDEF_FLAG_TLENCOLOR | TLEN_OPTIONS_PAGEDEF_FLAG_ICONTRANS;
tlen_functions->CallTlenFunction(hInst, TLEN_ADD_OPTIONS_PAGE, (WPARAM) hInst, (LPARAM) &def);
return 0;
}
__declspec(dllexport) int UnloadPlugin(void)
{
if (option_window)
{
tlen_functions->CallTlenFunction(hInst, TLEN_REMOVE_DIALOG_HANDLE, (WPARAM) option_window->Handle, NULL);
delete option_window;
}
DeleteObject(icon1);
DeleteObject(icon2);
return 0;
}